import java.util.ArrayDeque;
import java.util.Deque;
import java.util.LinkedList;
import java.util.List;

public class demo {
    public static void main(String[] args) {
        BinaryTree binaryTree = new BinaryTree();
        BinaryTree.TreeNode root = binaryTree.createTree();
        binaryTree.preOrder(root);
        System.out.println();
        binaryTree.inOrder(root);
        System.out.println();
        binaryTree.postOrder(root);
        System.out.println();
        System.out.println("===");
        List<BinaryTree.TreeNode> ret = binaryTree.preOrder1(root);
        for(BinaryTree.TreeNode x : ret){
            System.out.print(x.val + " ");
        }
        System.out.println();
        List<BinaryTree.TreeNode> ret1 = binaryTree.inOrder1(root);
        for(BinaryTree.TreeNode x : ret1){
            System.out.print(x.val + " ");
        }
        System.out.println();
        List<BinaryTree.TreeNode> ret2 = binaryTree.postOrder1(root);
        for(BinaryTree.TreeNode x : ret2){
            System.out.print(x.val + " ");
        }
        System.out.println();
        System.out.println("节点的个数：" + binaryTree.NodeSize(root));
        System.out.println("节点的个数：" + binaryTree.NodeSize2(root));
        binaryTree.getLeafNodeCount(root);
        System.out.println("叶子结点个数："+binaryTree.leafSize);
        System.out.println("叶子结点个数：" + binaryTree.getLeafNodeCount2(root));
        System.out.println("第3层结点的个数为"+binaryTree.getKLevelNodeCount(root, 3));
        System.out.println("树的高度" + binaryTree.getHeight(root));
    }

















    public static void main1(String[] args) {
        Deque<Integer> stack = new ArrayDeque<>();//双端队列的线性实现
        Deque<Integer> queue = new LinkedList<>();//双端队列的链式实现
        stack.push(1);
        stack.pop();

        queue.offer(1);
        queue.poll();
    }
}
